cmake_minimum_required(VERSION 3.10)  # 要求 CMake 3.10+
project(spatical_sampling LANGUAGES CXX CUDA)

# 设置 C++ 标准
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 设置全局优化级别
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")

# 设置 CUDA 标准
set(CMAKE_CUDA_STANDARD 11)
set(CMAKE_CUDA_STANDARD_REQUIRED ON)

set(CUDA_NVCC_FLAGS "${CUDA_NVCC_FLAGS} -Xcudafe --diag_suppress=20236") # 抑制编号为20236的警告

find_package(Eigen3 REQUIRED)
find_package(CUDAToolkit REQUIRED)

include_directories(${EIGEN3_INCLUDE_DIRS})  # 添加全局头文件搜索路径
include_directories(${CUDA_INCLUDE_DIRS})
include_directories(${CMAKE_SOURCE_DIR})  # 添加全局头文件搜索路径

add_subdirectory(gpu)
add_executable(spatical_sampling 
               main.cpp
               common/path.cpp)

target_link_libraries(spatical_sampling 
                      Eigen3::Eigen 
                      CUDA::cudart 
                      ${CUDA_cublas_LIBRARY}
                      gpu_library)
